// JavaScript Document
function reqGetAll() {
	$.getJSON(
		"cBasic/basic_readall.php?obj=request"+ "&" + Date.parse(new Date()),
		function(json){
			var title=json.title;
			var aaa=json.aaData;
			
			$('#Request .recsbox').html("");
			$('#Request .recsbox').html( '<table cellpadding="0" cellspacing="0" border="0" class="display" id="tRequest"></table>' );
			$('#tRequest').dataTable({	
				"bAutoWidth": true,
				"bStateSave": true,
				"sScrollX": "100%",
				"sScrollXInner": "100%",
				"bScrollCollapse": false,
				"sPaginationType": "full_numbers",
				"aaData":aaa,
				"aoColumns": [
					{ "sTitle":"ID",},
					{ "sTitle":"CustID"},
					{ "sTitle":"StartDate"},
					{ "sTitle":"EndDate"},
					{ "sTitle":"Description","bVisible":false},
					{ "sTitle":"Price[AUD]"},
					{ "sTitle":"Note","bVisible":false},
					{ "sTitle":"EmpNum."},
					{ "sTitle":"ProcessStep"},
					{ "sTitle":"RegDate&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"}
				],
				"aaSorting": [[ 5, "asc" ]]
			})
			$(".btool").click(function(){
				recsNew(title,'request');
				$('#spCustID').append('<span id="newCust" class="notice">  New Customer?  </span>');
				$('#newCust').click(function(){
					$(".issue").hide();
					$("#Customer").fadeIn(500);
					$(".btool").hide();
					cpage='Customer';
					// menu active style
					$(".bmenu").css("font-weight","");
					$(".bmenu:eq(0)").css("font-weight","bolder");
					custGetAll();
					$(".btool").fadeIn(500);
					removeUI();
					$.getJSON(
						"cBasic/basic_readfield.php?obj=customer"+ "&" + Date.parse(new Date()),
						function(jsoncust){
							recsNew(jsoncust.title,'customer');
					})
				})
			})
			tableEdit(json,aaa,title,'request','#viewbox');
		}
	)


}